jQuery.extend({
	// 转义JQ选择器中的字符 $("."+jqSelector(selector)) $("#"+jqSelector(selector))
	jqSelector : function(name) {
		return name
				.replace(/([;&,\.\+\*\~\':\"\!\^#$%@\[\]\(\)=>\|])/g, '\\$1');
	},
	/**
	 * example
	 * 
	 * js2php({foo:true, bar:false, baz: {a:1, b:2, c:[1, 2, 3]}}));
     * will return:
     * foo=true&bar=false&baz[a]=1&baz[b]=2&baz[c][0]=1&...etc
     * 
	 * @param obj
	 * @param path
	 * @param new_path
	 * @returns
	 */
    param : function(obj,path,new_path) {
	  if (typeof(path) == 'undefined') var path=[];
	  if (typeof(new_path) != 'undefined') path.push(new_path);
	  var post_str = [];
	  if (typeof(obj) == 'array' || typeof(obj) == 'object') {
	    for (var n in obj) {
	      post_str.push(this(obj[n],path,n));
	    }
	  }
	  else if (typeof(obj) != 'function') {
	    var base = path.shift();
	    post_str.push(base + (path.length > 0 ? '[' + path.join('][') + ']' : '') + '=' + encodeURI(obj));
	    path.unshift(base);
	  }
	  path.pop();
	  return post_str.join('&');
	} 

});
